import { createApp } from 'vue';
import App from './App';
import router from './router';
import store from './store';
import directive from './directive';
import plugins from './plugins';

// svg 图标
import 'virtual:svg-icons-register';
import SvgIcon from '@/components/SvgIcon';

// 样式
import '@/assets/styles/index.scss';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/assets/styles/all.min.css';

// 权限控制
import './permission';

// 插件拆分
import installElementPlus from './plugins/element';
import installGlobalMethods from './plugins/global';
import installGlobalComponents from './plugins/components';

// 分页组件
import Pagination from '@/components/Pagination';
// 自定义表格工具组件
import RightToolbar from '@/components/RightToolbar';
// 富文本组件
import Editor from '@/components/Editor';
// 文件上传组件
import FileUpload from '@/components/FileUpload';
// 图片上传组件
import ImageUpload from '@/components/ImageUpload';
// 图片预览组件
import ImagePreview from '@/components/ImagePreview';
// 字典标签组件
import DictTag from '@/components/DictTag';
// 全局table组件
import CustomTable from '@/components/CustomTable';
// 页面布局左右/上下布局
import VerticalLayout from './components/Content/VerticalLayout.vue';
import HorizontalLayout from './components/Content/HorizontalLayout.vue';
// 可编辑单元格组件
import EditableCell from './components/EditableCell/index.vue';
import EditableSelect from './components/EditableSelect/index.vue';
import EditableMultiSelect from './components/EditableMultiSelect/index.vue';
// 表格行插槽组件
import RowSlots from './components/RowSlots/index.vue';
import RowGoodsSlots from './components/RowSlots/goods.vue';
// 筛选表单组件
import FilterForm from './components/FilterForm/index.vue';

const app = createApp(App);
// 自动注册弹窗组件
installGlobalComponents(app);
// 指令
directive(app);

// 全局组件挂载
app.component('DictTag', DictTag);
app.component('Pagination', Pagination);
app.component('FileUpload', FileUpload);
app.component('ImageUpload', ImageUpload);
app.component('ImagePreview', ImagePreview);
app.component('RightToolbar', RightToolbar);
app.component('Editor', Editor);
// 自定义组件
app.component('CustomTable', CustomTable);
app.component('VerticalLayout', VerticalLayout);
app.component('HorizontalLayout', HorizontalLayout);
app.component('EditableCell', EditableCell);
app.component('EditableSelect', EditableSelect);
app.component('EditableMultiSelect', EditableMultiSelect);
app.component('FilterForm', FilterForm);
app.component('RowSlots', RowSlots);
app.component('RowGoodsSlots', RowGoodsSlots);

// 插件
app.use(router);
app.use(store);
app.use(plugins);
app.use(installElementPlus);
app.use(installGlobalMethods);
app.use(installGlobalComponents);

// 公共组件
app.component('svg-icon', SvgIcon);

app.mount('#app');
